//
//  RouterProductViewController.swift
//  TestIos
//
//  Created by liyadong on 2025/11/11.
//  Copyright © 2025 Liyadong. All rights reserved.
//

import UIKit
import SnapKit

@objc(RouterProductViewController)
class RouterProductViewController: UIViewController {
    
    var productId: String?
    var category: String?
    
    private let infoLabel = UILabel()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = .white
        title = "商品详情页"
        
        setupUI()
        displayInfo()
    }
    
    private func setupUI() {
        infoLabel.numberOfLines = 0
        infoLabel.textAlignment = .center
        infoLabel.font = .systemFont(ofSize: 16)
        infoLabel.textColor = .darkGray
        view.addSubview(infoLabel)
        
        infoLabel.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.leading.trailing.equalToSuperview().inset(20)
        }
    }
    
    private func displayInfo() {
        var infoText = "商品信息：\n\n"
        
        if let productId = productId {
            infoText += "商品ID: \(productId)\n"
        }
        
        if let category = category {
            infoText += "分类: \(category)\n"
        }
        
        infoLabel.text = infoText
    }
}

